<div class="layui-form layui-form-pane" style="margin:10px 5px">
    <input type="hidden" name="sysRole.id" data-th-value="${sysRole.id}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称:</label>
        <div class="layui-input-inline">
            <input type="text" name="sysRole.roleName" data-th-value="${sysRole.roleName}" required lay-verify="required" placeholder="请输入角色名称"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="edit_submit">提交</button>
        </div>
    </div>
</div>
<script th:inline="javascript">
    var layform;
    layui.use(['form'], function () { // 加载 layui的功能模块
        layform = layui.form;
        layform.render("checkbox"); // 重新渲染 checkbox
    });
    var currentId = [[${sysRole.id}]];
    layui.use('form', function () { //编辑框提交保存
        var form = layui.form;
        var editUrl = (currentId == -1) ? "/sys/role/add": "/sys/role/edit/" + currentId ;
        console.log('editUrl:'+editUrl);
        //监听提交
        form.on('submit(edit_submit)', function (params) {
            console.log(params.field);
            var reloadUrl = "/sys/role/list";
            mySubmit(editUrl, params.field,null,reloadUrl);
        });

    });

</script>